package com.itlong.cloud.paymenthub;

import com.itlong.cloud.POJO.DTO.app.AppUserAccountBalanceDTO;
import com.itlong.cloud.POJO.PO.AppUserAccountBalancePO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Map;

/**
 * <desc>
 *      账户余额及扣费暴露接口
 * </desc>
 *
 * @createDate 2018/4/23
 */
@FeignClient(name = "payment-hub-service")
public interface IAccountBalanceServiceClient {

    /**
     * <desc>
     *      根据userId查询余额
     * <desc/>
     * @param  userId   带查询的userId
     * @return 余额
     * @author Juguang.S
     * @createDate 2018/4/23
     */
    @PostMapping(path = "/show/getBalanceByUserId")
    BigDecimal getBalanceByUserId(@RequestParam("userId") String userId);

    /**
     * <desc>
     *      根据userId查询对象
     * <desc/>
     * @param  userId   带查询的userId
     * @return 余额
     * @author Juguang.S
     * @createDate 2018/4/23
     */
    @PostMapping(path = "/show/getUser")
    AppUserAccountBalancePO getUser(@RequestParam("userId") String userId);

    /**
     * <desc>
     *      扣费
     * <desc/>
     * @param
     * @return
     * @author Juguang.S
     * @createDate 2018/4/23
     */
    @PostMapping(path = "/show/updateBalance")
    Map<String, Object> updateBalance(@RequestBody AppUserAccountBalanceDTO appUserAccountBalanceDTO);

    /**
     * <desc>
     *      检查当前订单状态是否为支付成功
     * </desc>
     *
     * @param billsId 账单号
     * @return
     * @author Jiaqi.X
     * @createDate 2018/04/27
     */
    @PostMapping(path = "/show/checkTradeSuccess")
    Boolean checkTradeSuccess(@RequestParam("billsId") String billsId,@RequestParam("userId") String userId,@RequestParam("tradeId") String tradeId);

    /**
     * <desc>
     *      更新余额流水来源id
     * </desc>
     *
     * @param recordId 订单id
     * @param sourceId  来源id
     * @return
     * @author Jiaqi.X
     * @createDate 2018/04/28
     */
    @PostMapping(path = "/show/updateTradeSourceId")
    Integer updateTradeSourceId(@RequestParam("recordId") String recordId,@RequestParam("sourceId") String sourceId);

    /**
     * <desc>
     *      根据账单ID查询月卡订单的截止时间
     * </desc>
     *
     * @param billId 订单id
     * @return
     * @author Juguang.S
     * @createDate 2018/11/12
     */
    @PostMapping(path = "/show/getMonthCardTime")
    String getMonthCardTime(@RequestParam("billId") String billId);
}
